import 'package:animal/constant/appbar.dart';
import 'package:animal/constant/color.dart';
import 'package:animal/constant/font.dart';
import 'package:animal/item/buttom_item.dart';
import 'package:animal/item/mine_option_item.dart';
import 'package:animal/ui/mine/controller/mine_index_controller.dart';
import 'package:animal/utils/screen_util.dart';
import 'package:animal/widgets/HeaderWidget.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:getwidget/getwidget.dart';

///我的——首页
class MineIndexPage extends StatelessWidget {
  const MineIndexPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final MineIndexController controller = Get.put(MineIndexController());
    return Scaffold(
      backgroundColor: Colors.white,
      body: Column(
        children: [
          Container(
            margin: EdgeInsets.only(bottom: ScreenUtil().L(15)),
            child: Stack(
              alignment: Alignment.topCenter,
              children: [
                Image.asset("images/mine_bg.png", fit: BoxFit.fitWidth, width: double.infinity),
                Container(
                  margin: EdgeInsets.only(top: ScreenUtil().L(30)),
                  padding: EdgeInsets.only(top: ScreenUtil().L(50)),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().L(10)), topRight: Radius.circular(ScreenUtil().L(10)))),
                  child: Column(
                    children: [
                      Row(
                        children: [
                          Container(
                            width: ScreenUtil().L(30),
                          ),
                          Header.defaultHead(width: 70, height: 70, radius: 10),
                          Container(
                            width: ScreenUtil().L(20),
                          ),
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text("${controller.user["nickName"]}", style: KFontConstant.myTextStyle(size: 18, bold: true)),
                              Container(height: ScreenUtil().L(5)),
                              Text("账号: ${controller.user["account"]}", style: KFontConstant.myTextStyle(size: 15, color: KColorConstant.black666666)),
                            ],
                          ),
                        ],
                      ),
                      Container(
                        margin: EdgeInsets.symmetric(horizontal: ScreenUtil().L(20), vertical: ScreenUtil().L(15)),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            ButtonItem.iconTextButton(
                                child: GFIconButton(
                                  onPressed: () => controller.gotoWallet(),
                                  icon: Image.asset("icons/icon_wallet.png"),
                                  type: GFButtonType.transparent,
                                ),
                                text: "我的钱包"),
                            ButtonItem.iconTextButton(
                                child: GFIconButton(
                                  onPressed: () {},
                                  icon: Image.asset("icons/icon_collection.png"),
                                  type: GFButtonType.transparent,
                                ),
                                text: "我的收藏"),
                            ButtonItem.iconTextButton(
                                child: GFIconButton(
                                  onPressed: () {},
                                  icon: Image.asset("icons/icon_setting.png"),
                                  type: GFButtonType.transparent,
                                ),
                                text: "安全设置"),
                          ],
                        ),
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(vertical: ScreenUtil().L(15), horizontal: ScreenUtil().L(20)),
                        margin: EdgeInsets.symmetric(horizontal: ScreenUtil().L(10)),
                        decoration: BoxDecoration(color: const Color(0XFFFFDE9F), borderRadius: BorderRadius.circular(ScreenUtil().L(5))),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Text("商家服务", style: KFontConstant.myTextStyle(size: 17, color: Colors.black, bold: true)),
                                Container(height: ScreenUtil().L(5)),
                                Text("加入火讯，开启社交电商", style: KFontConstant.myTextStyle(size: 13, color: Colors.black)),
                              ],
                            ),
                            GFButton(
                                onPressed: () => controller.gotoVendorsService(),
                                text: "立即入驻",
                                shape: GFButtonShape.pills,
                                color: KColorConstant.black222,
                                textStyle: KFontConstant.myTextStyle(size: 15, color: Colors.white))
                          ],
                        ),
                      ),
                      Container(height: ScreenUtil().L(10))
                    ],
                  ),
                ),
                MyAppBar.defaultAppBar(
                    showBack: false,
                    showLine: false,
                    barTitle: "我的",
                    textColor: Colors.black,
                    marginLeft: ScreenUtil().L(20),
                    rightWidget: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        GFIconButton(icon: Image.asset("icons/icon_code.png"), onPressed: () {}, type: GFButtonType.transparent),
                        GFIconButton(icon: Image.asset("icons/icon_set.png"), onPressed: () => controller.gotoSet(), type: GFButtonType.transparent),
                      ],
                    )),
              ],
            ),
          ),
          Expanded(
            child: SingleChildScrollView(
              child: Container(
                margin: EdgeInsets.only(top: ScreenUtil().L(0)),
                child: Column(
                  children: [
                    Container(
                      color: Colors.white,
                      child: Column(
                        children: [
                          MineOptionItem(
                            image: "images/release.png",
                            name: "我发布的",
                            showBack: false,
                            onTap: () {},
                          ),
                          MineOptionItem(
                            image: "images/sell.png",
                            name: "我卖出的",
                            showBack: false,
                            onTap: () {},
                          ),
                          MineOptionItem(
                            image: "images/buy.png",
                            showBack: false,
                            name: "我买到的",
                            onTap: () {},
                          ), MineOptionItem(
                            image: "images/feed_back.png",
                            showBack: false,
                            name: "我的反馈",
                            onTap: () {},
                          ), MineOptionItem(
                            image: "images/help.png",
                            showBack: false,
                            name: "帮助中心",
                            onTap: () {},
                          ), MineOptionItem(
                            image: "images/about.png",
                            showBack: false,
                            name: "关于我们",
                            onTap: () {},
                          ), MineOptionItem(
                            image: "images/more_set.png",
                            showBack: false,
                            name: "更多设置",
                            onTap: () {},
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ),
          )
        ],
      ),
    );
  }
}
